package uk.co.revisual.utils.xml
{
		/**
		 * takes an xml node and returns an array of strings where the value of the attributes
		 * specified is concatinated with its URI. Used where namespaces are used to declare the 
		 * package / path for the attribute value.
		 * 
		 * @param xml: the xml node containing the attributes
		 * @param attributeLocalName: the local name of the attributes
		 * @returns an array of strings
		 */
		public function getPathsFromXML_URI( xml:XML, attributeLocalName:String ):Array
		{
			var attribs:XMLList = xml.attributes();
			var results:Array = [];
			
			// now we are going to loop through the attributes finding
			// those with a localname of "class" and if declared with 
			// namespace prepend the uri to is value
			for each( var a:XML in attribs ){
				var ns:Namespace = a.namespace();
				var localname:String = a.localName()
				
				// if the attribute has a namespace and localname is "class"
				// get the uri and add the value
				if( ns.prefix != "" && localname == attributeLocalName){
					var path:String = ns.uri;
					var name:String = a.toString();
					results.push( path + "." + name );
				} 
					// if no namespace is used, just return the value
				else if (localname == attributeLocalName){
					results.push( a.toString() );
				}
			}
			
			return results;
		}
}